package edu.xmist.demo15.controller;

public class CarFactory {

    Body createBody();

    Wheel createWheel();

    Engine createEngine();

    //...

    static class Body {

    }

    static class Wheel {

    }

    static class Engine {

    }


    public static void main(String[] args) {
        CarFactory carFactory = new CarFactory();
        Body body = carFactory.createBody();
        Wheel wheel = carFactory.createWheel();
        Engine engine = carFactory.createEngine();
        System.out.println("创建车身" + body);
        System.out.println("组装轮子" + wheel);
        System.out.println("安装引擎" + engine);
    }
}
